package wechat.service;

import com.alibaba.fastjson.JSONObject;

import wechat.resources.InstanceResource;


public interface AuthService {
	
	
	/**
	 * 获取UserId
	 * @param instanceResource
	 * @param code
	 * @return
	 * @throws Exception
	 */
	public String getUserId(InstanceResource instanceResource,String code) throws Exception;
	
	/**
	 * 获取授权URL
	 * @param instanceResource
	 * @param state
	 * @return
	 * @throws Exception
	 */
	public String getOauth2URL(InstanceResource instanceResource,String state) throws Exception;
	/**
	 * userid转换成openid
	 * 
	 * 不用红包或者支付请使用其他接口，传agentid和不传agentid获得的openid不一样，但是同一个人转换回userid是不变的
	 * 
	 * @param instanceResource
	 * @param userid
	 * @param agentid  需要发送红包的应用ID，若只是使用微信支付和企业转账，则无需该参数
	 * @return
	 * @throws Exception
	 */
	public String getOpenidByUserid(InstanceResource instanceResource,String userid,String agentid) throws Exception;
	/**
	 * userid转换成openid
	 * 
	 * 
	 * @param instanceResource
	 * @param userid
	 * @return
	 * @throws Exception
	 */
	public String getOpenidByUserid(InstanceResource instanceResource,String userid) throws Exception;
	/**
	 * openid转换成userid
	 * 
	 * @param instanceResource
	 * @param openid
	 * @return
	 * @throws Exception
	 */
	public String getUseridByOpenid(InstanceResource instanceResource,String openid) throws Exception;
	
	/**
	 * 获取js签名
	 * 
	 *  数据格式：
	 * 
	 * 	  	{                                       
	 *		   "url": "http://www.exmam.com",                         
	 *		}
	 * 
	 * @param instanceResource
	 * @param url
	 * @return
	 * @throws Exception
	 */
	public String getSignJSInfo (InstanceResource instanceResource,JSONObject jsonParam) throws Exception;
}
